package com.lap.web.starter.core.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.resource.NoResourceFoundException;

@Tag(name = "基础错误提示")
@Slf4j
@RestController
public class Error404Controller {

  @Operation(summary = "404页面")
  @GetMapping("404")
  public void error404(HttpServletRequest request) throws NoResourceFoundException {
    throw new NoResourceFoundException(
        HttpMethod.valueOf(request.getMethod()), request.getRequestURI());
  }
}
